package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/test")
@RestController
public class MyController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping("/testString")
    public String testString() {
        redisTemplate.opsForValue().set("key","111");
        String value = redisTemplate.opsForValue().get("key");
        System.out.println("value: "+value);

        return "ok!";
    }
}
